package com.cq.androidtools.jetpack.paging3

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import androidx.paging.PagingData
import androidx.paging.cachedIn
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

/**
 * 作者: CQ
 * 日期: 2021-07-07
 * 说明:
 */
@HiltViewModel
class MainViewModel @Inject constructor(val repo : Repository) : ViewModel() {

    fun getPagingData() : Flow<PagingData<Repo>> = repo.getPagingData().cachedIn(viewModelScope)
}